/**
 * Created by hxpeng on 2017/3/24.
 */
(function () {
    'use strict';

    angular.module('App.pages.member')
        .controller('NewTextEntrustCtrl', NewTextEntrustCtrl);

    function NewTextEntrustCtrl($scope,EntrustModel,AppUtils,$state) {
        var vm = this;
        vm.entrust = {};
        vm.entrust.entrustType = 'text';
        $scope.saveEntrust = function(){
            if(AppUtils.isUndefinedOrNull(vm.entrust.entrustContent)){
                AppUtils.showAlert("请输入嘱托内容！");
            }else{
                EntrustModel.saveEntrust(vm.entrust).$promise.then(function(response){
                    if(response.stat == 'success'){
                        AppUtils.showTipsTop("提交成功！");
                        $state.go("entrust.parentEntrustList");
                    }else{
                        AppUtils.showAlert("提交失败,请稍后再试~");
                    }
                })
            }
        }
    }

})();